package com.huwaiwai.jvm.demo02;

/**
 * -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8
 * Created by hww on 2018/6/6 下午8:51.
 */
public class Test {
    public static void main(String [] args) {
        Singleton s = Singleton.getSingleton();
        System.out.println(s.counter1);
        System.out.println(s.counter2);

    }
}

class Singleton {
    public static int counter1;
    public static int counter2 = 0;
    private static Singleton singleton = new Singleton();
    private Singleton() {
        counter1++;
        counter2++;
    }
    public static Singleton getSingleton() {
        return singleton;
    }
}
